const fs = require('fs-extra')
const path = require('path')
const { exec } = require('child_process')

fs.emptyDir(path.resolve(__dirname, '../app/public/css')).then(() => {
  return fs.emptyDir(path.resolve(__dirname, '../app/public/js'))
}).then(() => {
  fs.copy(path.resolve('./dist/'), path.resolve(__dirname, '../app/public'), err=> {
    fs.copyFile(path.resolve('./dist/index.html'), path.resolve(__dirname, '../app/view/index.ejs'), (err) => {
      if (err) throw err;
      console.log('publish complete');
    });
  })
}).catch(e => {
  console.error(e)
})
